<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>
        var arr = [[4, 7, 3], [6, 3, 1], [2, 5, 9], [8, 1, 5]];
        var res = [];
        for (var i = 0; i < arr[0].length; ++i) {
            res[i] = [];
            for (var j = 0; j < arr.length; ++j) {
                res[i][j] = arr[j][i];
            }
        }
        console.log(arr);
        console.log(res)
    </script>
</body>

</html>